<extend name="Public/base"/>
<block name="style">
    <style type="text/css">
        .btn {

            background: #09c;
        }

        .btn:hover {
            background: #09c;
        }

        .code {
            width: 135px;
            height: 40px;
            border: none;
            background: #4BBD00;
            color: #fff;

        }

        .real_status {
            width: 135px;
            height: 40px;
            border: none;
            background: #4BBD00;
            color: #fff;

        }

        p {
            height: 50px;
            line-height: 50px;
            font-size: 18px;
            margin-top: 20px;
        }

        .side-sub-menu > li > .item {
            color: #000;
            font-family: '宋体';
            font-size: 15px;
            padding: 0px;
            line-height: 25px;
        }

        .sidebar {
            background: #3697A0;
            position: absolute;
        }

        form .form-item {
            width: 50%;

        }

        /* 头部Logo,主导航*/
        body {
            color: #000;
            font-family: '宋体';
            font-weight: 900;
        }

        .header {
            background-color: #3697A0;
            height: 45px;
        }

        /* 主导航 */
        .main-nav a {
            height: 45px;
            color: #150303;
        }

        .main-nav a:hover {
            height: 45px;
            background-color: #70bcf3;
            color: #150303;
        }

        .main-nav .current {
            height: 45px;
            background-color: #70bcf3;
        }

        .main-nav .current a {
            height: 45px;
            background-color: #70bcf3;
            color: #150303;
        }

        .logo {
            height: 45px;
            background: #ccc;
        }

        .sidebar {
            margin-top: -5px;
            background: #3697A0;
            color: #000;
            position: fixed;
            height: 110%;
            margin-top: -40px;
        }

        .subnav h3 {
            color: #000;
        }

        .main-nav {
            /*width:100%;*/
            float: none;
            height: auto;
        }

        .mainnav {
            /*height: auto;*/
            height: 100%;
        }

        .main-nav li {
            float: none;
            width: 180px;
        }


    </style>
</block>
<block name="body">
    <div class="main-title">
        <h2>口碑商户资料</h2>
    </div>


    <form action="{:U()}" method="post" class="form-horizontal">


        <php>

            if(empty($_list['status'])){
            $tatus=0;
            }else{
            $status=1;
            }

        </php>

        <div class="form-item">
        <label class="item-label">授权码<span class="check-tips" style="color:red;">（以此获取授权信息，使用一次后失效，切记保存）</span></label>
        <div class="controls">
        <input type="text" style="height:30px;" class="text input-large app_auth_code" readonly="readonly" name="app_auth_code" value="{$_list.app_auth_code}">
        </div>
         <input type="button" class="code" id="code" value="获取授权令牌">
        </div>
        <div class="form-item">
            <label class="item-label">码主姓名</label>
            <div class="controls">
                <input type="text" style="height:30px;" class="text input-large" name="name" value="{$_list.name}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">码主支付宝</label>
            <div class="controls">
                <input type="text" style="height:30px;" class="text input-large" name="alipay" value="{$_list.alipay}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">平台费率</label>
            <div class="controls">
                <input type="text" style="height:30px;" class="text input-large" name="rate" value="{$_list.rate}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">码主费率</label>
            <div class="controls">
                <input type="text" style="height:30px;" class="text input-large" readonly name="rate2"
                       value="{$_list.rate2}">
            </div>
        </div>
        <div class="form-item">
        <label class="item-label">授权令牌（app_auth_token）</label>
        <div class="controls">
        <input type="text" style="height:30px;" class="text input-large" <eq name="status" value="1">disabled</eq>  name="app_auth_token" value="{$_list.app_auth_token}">
        </div>
        </div>
        <div class="form-item">
        <label class="item-label">刷新令牌（app_refresh_token）</span></label>
        <div class="controls">
        <input type="text" style="height:30px;" class="text input-large" <eq name="status" value="1">disabled</eq> name="app_refresh_token" value="{$_list.app_refresh_token}">
        </div>
        </div>
        <div class="form-item">
        <label class="item-label">授权商户app_id（auth_app_id）</span></label>
        <div class="controls">
        <input type="text" style="height:30px;" class="text input-large" <eq name="status" value="1">disabled</eq> name="auth_app_id" value="{$_list.auth_app_id}">
        </div>
        </div>
        <div class="form-item">
        <label class="item-label">授权商户id（user_id）</span></label>
        <div class="controls">
        <input type="text" style="height:30px;" class="text input-large" readonly name="user_id" value="{$_list.user_id}">
        </div>
        </div>

        <div class="form-item">
        授权令牌有效时间：365天，刷新令牌有效时间：372天，授权令牌失效后请及时使用刷新令牌重新获取授权令牌。
        </div>



        <div>
            <p><a href="http://qnm.upslope.cn/index.php?m=Admin&c=Alipay&a=kb_dingdan&id={$vo.user_id}" class="button grey" >{$_list.user_id}</a></p>
            <p>交易总金额： {$_list.total_money}</p>
            <p>今日交易总金额：： {$_list.today_money}</p>

        </div>


        <div class="form-item">
            <button class="btn submit-btn" id="submit" type="button" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>

            <span class="btn  sq" style="width:132.167px;height:38px;text-align:center;padding:0px;line-height:38px;">解除授权</span>


        </div>


    </form>
</block>
<block name="script">


    <script type="text/javascript">

        Think.setValue("extend", {$info.extend |
        default
        = 0
        })
        ;
        //导航高亮
        highlight_subnav('{:U('
        index
        ')}'
        )
        ;

        // $('#code').click(function(){
        //     var code=$('.app_auth_code').val();
        //     location.href="{:U('Alipay/get_token?code=')}"+code;
        // })

        $('#submit').click(function () {
            var data = $('form').serializeArray();
            $.ajax({
                type: 'post',
                url: '',
                data: data,
                success: function (m) {
                    if (m >= 1) {
                        alert('修改成功！');
                        location.href = "{:U('index')}";
                    } else if (m == 0) {
                        alert('修改失败！');
                    } else {
                        alert(m)
                    }
                }

            })
        })

        $('.sq').click(function () {

            var app_auth_code = $('.app_auth_code').val();
            // alert(app_auth_code)
            $.ajax({
                type: 'post',
                data: {'app_auth_code': app_auth_code, 'type': 1},
                url: "{:U('shouquan')}",
                success: function (m) {
                    // alert(m)
                    if (m == 1) {
                        alert('解除成功！');
                        location.href = "{:U('index')}";
                    } else if (m == 0) {
                        alert('解除失败！');
                    } else {
                        alert(m)
                    }
                }
            })

        })

    </script>

    <!-- app_auth_token":"201712BBdf7f602ee00f4a6ca88e1116f468bD12","app_refresh_token":"201712BBc70480b713d141529bf20d71c1cb4B12","auth_app_id":"2017051207213149","user_id":"2088721036926123"} -->

</block>

